<?php

namespace front\models;

use Yii;

/**
 * This is the model class for table "orders".
 *
 * @property integer $order_id
 * @property string $order_char_id
 * @property integer $parent_order_id
 * @property integer $seller_id
 * @property integer $customer_id
 * @property integer $channel_source
 * @property integer $device_source
 * @property integer $status
 * @property integer $order_time
 * @property integer $payment_time
 * @property double $order_cost
 * @property double $cost
 * @property double $discount
 * @property string $available_coupons
 * @property string $use_coupons
 * @property integer $is_settled
 * @property integer $is_hasInv
 * @property integer $inv_id
 * @property integer $payment_type
 * @property integer $send_time
 * @property string $remark
 * @property string $express
 * @property integer $order_users_id
 * @property integer $complete_time
 */
class OrderModel extends \common\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'orders';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('db');
    }
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['parent_order_id', 'seller_id', 'customer_id', 'channel_source', 'device_source', 'status', 'order_time', 'payment_time', 'is_settled', 'is_hasInv', 'inv_id', 'payment_type', 'send_time', 'order_users_id', 'complete_time'], 'integer'],
            [['seller_id', 'customer_id', 'channel_source', 'device_source', 'status', 'order_cost', 'order_users_id'], 'required'],
            [['order_cost', 'cost', 'discount'], 'number'],
            [['order_char_id'], 'string', 'max' => 32],
            [['available_coupons', 'use_coupons', 'remark', 'express'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'order_id' => 'Order ID',
            'order_char_id' => 'Order Char ID',
            'parent_order_id' => 'Parent Order ID',
            'seller_id' => 'Seller ID',
            'customer_id' => 'Customer ID',
            'channel_source' => 'Channel Source',
            'device_source' => 'Device Source',
            'status' => 'Status',
            'order_time' => 'Order Time',
            'payment_time' => 'Payment Time',
            'order_cost' => 'Order Cost',
            'cost' => 'Cost',
            'discount' => 'Discount',
            'available_coupons' => 'Available Coupons',
            'use_coupons' => 'Use Coupons',
            'is_settled' => 'Is Settled',
            'is_hasInv' => 'Is Has Inv',
            'inv_id' => 'Inv ID',
            'payment_type' => 'Payment Type',
            'send_time' => 'Send Time',
            'remark' => 'Remark',
            'express' => 'Express',
            'order_users_id' => 'Order Users ID',
            'complete_time' => 'Complete Time',
        ];
    }
}
